package cn.mybatis.plugin.controller;

import cn.mybatis.plugin.domain.PageInfo;
import cn.mybatis.plugin.domain.Result;
import cn.mybatis.plugin.service.MybatisService;
import cn.mybatis.plugin.vo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * @author: 张澎_9970
 * @date: 2022.1.17 下午 10:58
 */
@RestController
@RequestMapping("mybatis")
@Slf4j
public class MybatisController {
    @Autowired
    private MybatisService mybatisService;

    @GetMapping("/plugin/{page}/{size}")
    public Result<PageInfo<User>> gen(@PathVariable("page") int page, @PathVariable("size") int size) {
        log.info("page: " + page);
        log.info("size: " + size);
        return Result.success(mybatisService.gen(page, size));
    }
}
